home *** CD-ROM | disk | FTP | other *** search
- /* XGIStdClassFactory.cpp
- *
- * The class factory for my standard controls
- */
-
- /* YAAF - Yet another application framework
- * Copyright (C) 1997 William Edward Woody and In Phase Consulting
- *
- * This library is free software; you can redistribute it
- * and/or modify it under the terms of the GNU Library
- * General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or any
- * later version.
- *
- * This library is distributed in the hope that it will be
- * useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABIILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU Library General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Library General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * To contact the author, either e-mail me at
- * woody@alumni.caltech.edu, or write to us at
- *
- * William Edward Woody
- * In Phase Consulting
- * 1545 Ard Eevin Avenue
- * Glendale, CA 91202
- */
-
- #include "factory.h"
- #include <XStdControls.h>
- #include <XStdButtons.h>
- #include <XStdScroll.h>
- #include <XStdScrollView.h>
- #include <XStdText.h>
- #include <XStdImage.h>
- #include <XStdList.h>
-
- /************************************************************************/
- /* */
- /* Globals */
- /* */
- /************************************************************************/
-
- static XGIStdClassFactory *GClass;
-
- /************************************************************************/
- /* */
- /* Factory */
- /* */
- /************************************************************************/
-
- /* XGIStdClassFactory::CreateView
- *
- * Create view factory
- */
-
- XGView *XGIStdClassFactory::CreateView(long type, XGView *view, XGArgStream &stream)
- {
- switch (type) {
- case 'pbtn':
- return new XGStdPushButton(view,stream);
- case 'cbtn':
- return new XGStdCheckButton(view,stream);
- case 'rbtn':
- return new XGStdRadioButton(view,stream);
- case 'scrl':
- return new XGStdScroll(view,stream);
- case 'text':
- return new XGStdStaticText(view,stream);
- case 'edit':
- return new XGStdEditText(view,stream);
- case 'grou':
- return new XGStdGroupBox(view,stream);
- case 'pict':
- return new XGStdPicture(view,stream);
- case 'icon':
- return new XGStdIcon(view,stream);
- case 'list':
- return new XGStdListBox(view,stream);
-
- case 'scrv':
- return new XGScrollView(view,stream);
-
- default:
- return NULL;
- }
- }
-
- /************************************************************************/
- /* */
- /* External routines */
- /* */
- /************************************************************************/
-
- /* XGKillStandardControls
- *
- * Kill my standard control factory
- */
-
- void XGKillStandardControls(void)
- {
- if (GClass) delete GClass;
- }
-
- /* XGInitStandardControls
- *
- * Standard control factory
- */
-
- void XGInitStandardControls(void)
- {
- GClass = new XGIStdClassFactory;
- }
-